#include "WidgetAnimationTrigger.h"
#include "Time/Time.h"

bool RWidgetAnimationTrigger::IsActive() 
{
    float _Duration = Duration.Get();
    if(_Duration<=0)
    {
        return bIsActive;
    }

    float ElapsedTime = WH::GetSecondsFrom(StartTime);
    if(ElapsedTime>_Duration)
    {
        bIsActive=false;
    }

    return bIsActive;
}

void RWidgetAnimationTrigger::Activate()
{
    bIsActive=true;
    StartTime=std::chrono::steady_clock::now();
}